package com.ruiyi.subway.exception;


import com.ruiyi.subway.enums.ExceptionCode;

/**
 * Created by jiangshicun on 17/10/16.
 */
public class BusinessException extends Exception {
    private static final long serialVersionUID = -7285129617596922166L;

    public BusinessException() {
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public static BusinessException buildException(ExceptionCode code) {
        return new BusinessException(code.getMessage());
    }

    public static BusinessException buildTenantNotExistsException() {
        return buildException(ExceptionCode.TENANT_NOT_EXISTS);
    }
}
